interface Env {
    mode: 'dev' | 'test' | 'prod'
}

// 获取命令行的参数
export const getCommandArgs = () => {
    const args = process.argv.slice(2)

    if (args.length > 0) {
        return args.reduce((obj, cur) => {
            const strArr = cur.split('=')
            obj[strArr[0]] = strArr[1]

            return obj
        }, {}  as { [p: string]: string } & Env)
    }

    return null
}